home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Adobe Graphics & Publishing SDK 1996 December
/
Adobe Graphics & Publishing SDK 1996 December.iso
/
mac
/
Premiere 4.2 SDK r3 Mac
/
Examples
/
Projects
/
Video Noise
/
Noise.c
next >
Wrap
Text File
|
1996-01-25
|
2KB
|
57 lines
//========================================================================================
//
// Noise.c - Simulate video noise by mucking the low bits of the channel values.
//
// Written by Randy Ubillos and Bryan K. "Beaker" Ressler.
//
// Copyright ⌐ 1996, Adobe Systems Incorporated, all rights reserved worldwide.
//
// Version 1.00 9/12/94 Original version.
// Version 1.02 10/8/95 Updated for 4.2 and CW7.
//
//========================================================================================
//========================================================================================
// Prototypes
//========================================================================================
void Noise (unsigned char *src, unsigned char *dst, short height, short rowBytes,
unsigned long mask);
//========================================================================================
// Routine to add noise to an image. This is a "C" language version of the assembly code
// in "Noise.a".
//========================================================================================
void Noise (unsigned char *src, unsigned char *dst, short height, short rowBytes,
unsigned long mask)
{
short h, v, value;
long rowLongs = rowBytes / 4;
for (v = 0; v < height; v++) {
for (h = 0; h < rowLongs; h++) {
*dst++ = *src++;
value = *src++;
if (value >= 0x08 && value <= 0xF8) {
value ^= mask & 0xFF;
mask = (mask << 24) + (mask >> 8);
}
*dst++ = value;
value = *src++;
if (value >= 0x08 && value <= 0xF8) {
value ^= mask & 0xFF;
mask = (mask << 24) + (mask >> 8);
}
*dst++ = value;
value = *src++;
if (value >= 0x08 && value <= 0xF8) {
value ^= mask & 0xFF;
mask = (mask << 24) + (mask >> 8);
}
*dst++ = value;
}
}
}